import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
const routes = [];
const views=NodeJs.readViews('../views')

views.forEach(function (view){
  routes.push({
    path: '/' + view,
    name:view,
    component: () => {
      return import(/* webpackChunkName: "[request]"  */ `../views/${view}`)
    }
  })
})
routes.push({
  path: '/*',
  component: () => {
    return import(/* webpackChunkName: "[request]"  */ `../views/home`)
  }
})
const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
